package com.demo.test.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.List;

/**
 * @author maoxiaomeng
 */
@Data
@Accessors(chain = true)
@ApiModel(value = "方法参数")
public class MethodParameterPo implements Serializable {
    private static final long serialVersionUID = -3636703657738690902L;
    @ApiModelProperty(required = true, value = "接口参数名")
    String key;
    @ApiModelProperty(required = true, value = "接口的参数全路径名,包含了接口所在类的层级,\".\"号分割")
    String absoluteKey;
    @ApiModelProperty(required = true, value = "参数说明")
    String info;
    @ApiModelProperty(required = true, value = "示例值")
    String example;
    @ApiModelProperty(required = true, value = "扩展字段字段说明")
    String extend;
    @ApiModelProperty(required = true, value = "是否必须填写")
    Boolean necessary;
    @ApiModelProperty(required = true, value = "数据类型type")
    Type type;
    @ApiModelProperty(required = true, value = "数据类型type String")
    DataType typeName;
    @ApiModelProperty(required = true, value = "数据类型解释")
    String typeNameDesc;
    @ApiModelProperty(required = true, value = "其它所有的参数")
    List<MethodParameterPo> children;



    @Getter
    @AllArgsConstructor
    public enum DataType {
        /**
         * ruleType标识中带有
         */
        BOOLEAN("BOOLEAN", "布尔"),
        STRING("STRING", "字符串"),
        INT("INT", "整型"),
        LONG("LONG", "长整型"),
        FLOAT("FLOAT", "单精度浮点数"),
        DOUBLE("DOUBLE", "双精度浮点数"),
        DATETIME("DATETIME", "日期类型"),
        OBJ("OBJ", "对象"),
        ARRAY("ARRAY", "数组类型"),
        /**
         * 扩展-数字类型
         */
        NUMBER("10", "数值类型");

        private String code;
        private String desc;

    }
}
